<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*
    promise实列有两个属性：
    
    -1.promisestate:状态(只要没有调用resolve或者reject promisestate的状态永远为pending)
    pending   正在进行中(默认值)
    fulfilled 成功状态
    rejected  失败状态

    -2.promisereslut:(成功或者失败后的携带的值)
      默认是undefined
      如果resolve或者reject函数传入了参数，则这个值就是它两函数中的实参
    */
    const p1 = new Promise((resolve, reject) => {

      setTimeout(() => {
        console.log('请求数据');
        // resolve('ok')
        reject('失败')
      }, 2000)
    })
    console.log('p1', p1);
  </script>
</body>

</html>